package com.thti.mecool.client.adapter;

import java.util.List;

import com.thti.mecool.client.activity.R;
import com.thti.mecool.client.protocol.work.MemoDto;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class WorkMemoShowAdapter extends BaseAdapter{
	private List<MemoDto> MemoList;
	private Context context;
	public WorkMemoShowAdapter(List<MemoDto> MemoList,Context context) {
this.MemoList=MemoList;
this.context=context;
	}
	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return MemoList.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return MemoList.get(position);
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}
	class ViewHolder{
		TextView content,shop,time;
	}
	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		ViewHolder holder=null;
		if(convertView==null){
			holder=new ViewHolder();
			convertView=LayoutInflater.from(context).inflate(R.layout.mecool_workmemo_first, null);
			holder.content=(TextView)convertView.findViewById(R.id.mecool_workmemo_first_content);
			holder.shop=(TextView)convertView.findViewById(R.id.mecool_workmemo_first_shop);
			holder.time=(TextView)convertView.findViewById(R.id.mecool_workmemo_first_time);
			convertView.setTag(holder);
		}else{
			holder=(ViewHolder) convertView.getTag();
		}
		holder.content.setText(MemoList.get(position).getContent());
		holder.shop.setText(MemoList.get(position).getChannelName());
		holder.time.setText(MemoList.get(position).getRecordDate());
		return convertView;
	}

}
